﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace UI.Forms
{
    public partial class station_U : FormBase1
    {
        public delegate void DoAction();//如果有参数的话，定义参数 

        public DoAction FatherRefresh;
        private int count = 0;
        private SVC.client.Station st;
        public station_U(SVC.client.Station _st)
        {
            InitializeComponent();
            st = _st;
        }

        private void btn_new_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!dxValidationProvider1.Validate()) return;
            st.StationName = te_name.Text.Trim();
            string r = my.bw.Station_Update(st, my.ACID);
            if (string.IsNullOrWhiteSpace(r))
            {
                count++;
                this.Close();
            }
            else
            {
                Comm.ShowErorr(r);
            }
                
            
        }

        private void station_N_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (count>0)
            {
                FatherRefresh();
            }
        }
    }
}